<template lang="html">
  <div class="main-page" id="store-page">
    <nav-bar :title="title"  @goBack="onClickLeft"/>
    <template v-for="(item, index) in activeList">
      <div class="activity_main" :key="index">
        <div class="a_item" @click="goUrl(item.activity_url)">
          <img :src="item.pic_url" alt="">
          <div class="a_item_info">
            <h3>{{item.activity_name}}</h3>
            <p>活动时间：{{item.begin_time}} - {{item.end_time}}</p>
          </div>
        </div>
      </div>
    </template>
  </div>
</template>

<script>
import NavBar from '@/components/global/nav-bar.vue'
import Tool from '@/utils/tool.js'

export default {
  components: { NavBar },
  data () {
    return {
      title: '热门活动',
      activeList: []
    }
  },
  created () {
    this.getList()
  },
  methods: {
    onClickLeft () {
      this.$router.go(-1)
    },
    imgPath (src) {
      return Tool.imgPath(src)
    },
    goUrl (i) {
      // this.$router.push(i)
      window.location.href = i
    },
    getList () {
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'activity_hot?pagesize=99', method: 'get' }).then((resp) => { // 请求成功
          if (resp.return_code === '0000') {
            this.activeList = resp.data.list
          }
          resolve(resp)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    }
  }
}
</script>

<style lang="css" scoped>

</style>
